Imports System.Data
Partial Class Client_frmForgotPassword
    Inherits System.Web.UI.Page
    Dim _bo As New Bo
    Dim dt As New DataTable
    Dim _Answer As String

    Protected Sub lnk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnk.Click
        If txtUserId.Text = "" Then
            MsgBox("User ID Cannot Be Empty")
        Else
            lblUserId.Text = txtUserId.Text
            lnk.Visible = "false"
            lblUserId.Visible = "true"
            txtUserId.Visible = "false"
            dt = _bo.getSecurityQuestion(txtUserId.Text)
            If dt.Rows.Count = 0 Then
                MsgBox("No Such User Exist ! Try Again")
            Else
                lblQuestion.Text = dt.Rows(0).Item(0).ToString
            End If
        End If
    End Sub

    Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        dt = _bo.getSecurityQuestion(txtUserId.Text)
        _Answer = dt.Rows(0).Item(1).ToString
        If (txtAnswer.Text = _Answer) Then
            Session("UserId") = lblUserId.Text
            Response.Redirect("frmModifyPassword.aspx")
        Else
            MsgBox("Your Answer Is Incorrect")
        End If

    End Sub

    Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReset.Click
        txtAnswer.Text = ""
        txtUserId.Text = ""
    End Sub
End Class
